home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / COMM.SWG / 0002_Carrier Detect.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  603b  |  32 lines

  1. {
  2. >Does anyone know how to detect when the modem connects?? Thanks.
  3.  
  4. Through the BIOS:
  5. }
  6.  
  7. Function CarrierDetected(Port : Word) : Boolean;
  8. Const
  9.   DCD = $80;
  10. Var
  11.   Dummy : Byte;
  12. begin
  13.   Asm
  14.     dec port
  15.     mov ah,03h
  16.     mov dx,port
  17.     int 14h
  18.     mov dummy,al
  19.   end;
  20.   CarrierDetected := (Dummy and DCD) = DCD       { carrier detected }
  21. end;
  22.  
  23. { Or directly: }
  24.  
  25. Function CarrierDetected(Port : Byte) : Boolean;
  26. begin
  27.   Case Port of
  28.     1: CarrierDetected := ($3FE and $80) = $80;   { com 1 cd }
  29.     2: CarrierDetected := ($2FE and $80) = $80    { com 2 cd }
  30.   end
  31. end;
  32.